package com.yt.app.api.vo;

import com.yt.app.api.util.Config;
import com.yt.order.api.model.Product;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * Description
 * <p> 前端接口商品
 * </p>
 * DATE 2017/10/3.
 *
 * @author liujunshi.
 */

@ApiModel(value = "商品信息", description = "")
public class ProductVo implements Serializable {
    @ApiModelProperty(value = "商品ID")
    private Long id;
    @ApiModelProperty(value = "商品名称")
    private String name;
    @ApiModelProperty(value = "商品类别")
    private Long productTypeId;
    @ApiModelProperty(value = "商品类别名称")
    private String productTypeName;
    @ApiModelProperty(value = "善品图片")
    private String imageFile;
    @ApiModelProperty(value = "市场价格")
    private Long price;
    @ApiModelProperty(value = "销售价格")
    private Long salePrice;
    @ApiModelProperty(value = "机构ID")
    private Long idInstitution;
    @ApiModelProperty(value = "机构名称")
    private String institutionName;
    @ApiModelProperty(value = "商品描述")
    private String description;
    @ApiModelProperty(value = "商品是否有效,1:有效，0:无效")
    private Integer status;
    @ApiModelProperty(value = "链接地址")
    private String link;

    public ProductVo(){}

    public ProductVo(Product product){
        this.id = product.getId();
        this.name = product.getName();
        this.imageFile = product.getImageFile();
        this.price = product.getPrice();
        this.salePrice = product.getSalePrice();
        this.idInstitution = product.getIdInstitution();
        this.institutionName = product.getInstitutionName();
        this.description = product.getDescription();

        if("0".equals(product.getIsPublic()) || "0".equals(product.getOnsale())){
            this.status = 0;
        }else{
            this.status = 1;
        }

        this.link = Config.appH5Host + "/app/product/detail?id=" + this.id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getPrice() {
        return price;
    }

    public void setPrice(Long price) {
        this.price = price;
    }

    public Long getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(Long salePrice) {
        this.salePrice = salePrice;
    }

    public Long getIdInstitution() {
        return idInstitution;
    }

    public void setIdInstitution(Long idInstitution) {
        this.idInstitution = idInstitution;
    }

    public String getInstitutionName() {
        return institutionName;
    }

    public void setInstitutionName(String institutionName) {
        this.institutionName = institutionName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Long getProductTypeId() {
        return productTypeId;
    }

    public void setProductTypeId(Long productTypeId) {
        this.productTypeId = productTypeId;
    }

    public String getProductTypeName() {
        return productTypeName;
    }

    public void setProductTypeName(String productTypeName) {
        this.productTypeName = productTypeName;
    }

    public String getImageFile() {
        return imageFile;
    }

    public void setImageFile(String imageFile) {
        this.imageFile = imageFile;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }
}
